#include <iostream>
#include <string>
using namespace std;

struct item
{
	int cost;
	int price;
	string name;
};

void Display(item item1, item item2)
{
	cout<<"name: "<<item1.name<<" price: "<<item1.price<<" cost: "<<item1.cost<<endl;
	cout<<"name: "<<item2.name<<" price: "<<item2.price<<" cost: "<<item2.cost<<endl;

}

void Clear (item &item1, item &item2)
{
	item1.cost = 0;
	item2.cost = 0;
	item1.price = 0;
	item2.price = 0;
	item1.name = " ";
	item2.name = " ";
}
void EditOne(item &item1, item &item2)
{
	int edit;
	cout<<"Enter 1 to edit ITEM_1, 2 to edit ITEM_2"<<endl;
	cin>>edit;
	
	if (edit ==1)
	{
		cout<<"enter ITEM_1 name: ";
		cin>>item1.name;
		cout<<"enter ITEM_1 cost: ";
		cin>>item1.cost;
		cout<<"enter ITEM_1 price: ";
		cin>>item1.price;
	}
	else if (edit ==2)
	{
        cout<<"enter ITEM_2 name";
		cin>>item2.name;
		cout<<"enter ITEM_2 cost: ";
		cin>>item2.cost;
		cout<<"enter ITEM_2 price: ";
		cin>>item2.price;
	}

}
void Edit (item &item1, item &item2)
{
	cout<<"\nItem 1 name :";
	cin>>item1.name;
	cout<<"\nItem 2 name :";
	cin>>item2.name;
	cout<<"\nItem 1 cost :";
	cin>>item1.cost;
	cout<<"\nitem 2 cost :";
	cin>>item2.cost;
	cout<<"\nItem 1 price :";
	cin>>item1.price;
	cout<<"\nItem 2 price :";
	cin>>item2.price;

	
}
int main(void)
{
	//int edit;
	int choice;
	item item1;
	item item2;
	item2.cost = 5;
	item1.cost = 10;
	item1.price = 4;
	item2.price = 12;
	item1.name = "pie";
	item2.name = "egg";


	while(true)
	{
		cin>>choice;
		system("cls");
		if(choice ==1)
		{
			Display (item1, item2);
		}
		else if(choice ==2)
		{
			Clear (item1,item2);
			Display (item1, item2);

		}
		else if(choice==3)
		{
			Edit(item1,item2);
			Display (item1,item2);
		}
		else if(choice ==4)
		{
			EditOne(item1,item2);
			Display (item1, item2);
		}
		else
		{
			return 0;
		}
	}
	system("pause");
	return 0;
}